package com.dahua.messagesyncsh.business.mitsubishi.http;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.UUID;

/**
 * 统一返回类型
 */
@Getter
@Setter
@AllArgsConstructor
@Builder
public class Response<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 状态码
     */
    private String code;

    /**
     * 文字描述
     */
    private String message;

    /**
     * 总数
     */
    private Long total;

    /**
     * 数据
     */
    private T data;

    /**
     * 响应标识
     */
    private String requestid;

    public Response(){
        this(null, null, null, null, UUID.randomUUID().toString().replaceAll("-", ""));
    }

    public Response<T> total(Long total) {
        this.total = total;
        return this;
    }
}